#ifndef _CHECK_FILE__H__
#define _CHECK_FILE__H__

#include <stdint.h>

typedef enum{
    S19_NO_ERROR = 0,
    S19_FORMAT_ERROR = -1,
    S19_TYPE_ERROR = -2,
    S19_VERIFY_ERROR = -3,
    S19_LENGHT_ERROR = -4,
}S19ErrCode;

typedef enum{
    S19_TYPE_S0 = 0,
    S19_TYPE_S1,
    S19_TYPE_S2,
    S19_TYPE_S3,
    S19_TYPE_S5,
    S19_TYPE_S7,
    S19_TYPE_S8,
    S19_TYPE_S9,
    S19_TYPE_S_UNKNOW
}em_S19Type;

typedef struct 
{
    em_S19Type Type;
    uint32_t address;
    uint8_t count;
    uint8_t data[100];
    uint8_t checkSumCode;
    uint8_t dataLen;
}str_S19LineData;



typedef enum{
    HEX_NO_ERROR = 0,
    HEX_FORMAT_ERROR = -1,
    HEX_TYPE_ERROR = -2,
    HEX_VERIFY_ERROR = -3,
    HEX_LENGHT_ERROR = -4,
}HEXErrCode;

typedef enum{
    HEX_DATA = 0,
    HEX_END,
    HEX_ESA,
    HEX_SSA,
    HEX_ELA,
    HEX_SLA,
    HEX_UNKNOW
}em_HEXType;

typedef struct 
{
    em_HEXType Type;
    uint32_t address;
    uint32_t baseAddr;
    uint8_t data[256];
    uint8_t checkCode;
    uint8_t dataLen;
}str_HEXLineData;

char ConvertHexChar(char ch);
S19ErrCode validateS19String(const char* s19String, unsigned int strLen,str_S19LineData *S19LineData);
HEXErrCode validateHEXString(const char* hexString, unsigned int strLen,str_HEXLineData *HEXLineData);

#endif



